#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "databasehandler.h"

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void onAddContact();
    void onEditContact();
    void onDeleteContact();
    void onContactSelected(const QModelIndex &index);
    void refreshContactList();

private:
    Ui::Widget *ui;
    DatabaseHandler *m_dbHandler;
    int m_currentContactId;

    void clearInputFields();
    void setupTable();
};

#endif // WIDGET_H
